import os
import time
import tempfile

file_handler, file_path = tempfile.mkstemp(suffix='.txt', text=True)

try:
    os.close(file_handler)
    print file_path
finally:
    time.sleep(3)
    os.unlink(file_path)
